#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @FileName  :base-lineRecursion.py
# @Time      :2021/3/18 21:55
# @Author    :Letquit
"""
文件说明：基线条件和递归条件

"""
# 递归函数调用自己，容易出错导致无限循环
# def countdown(i):
#     print(i)
#     countdown(i - 1)
# countdown(3)    # maximum recursion depth exceeded while calling a Python object
# 编写递归函数必须告诉它何时停止递归
# 递归条件指函数调用自己
# 基线条件指函数不在调用自己，避免形成无限循环
def countdown(i):
    print(i)
    if i <= 0:    # 基线条件
        return
    else:
        countdown(i - 1)    # 递归条件
print(countdown(3))

















if __name__ == "__main__":
    run_code = 0
